load(key).

discretize(entropy).
use_package(hypspc).
minimal_cases(2).                      %  Número de ejemplos cubiertos por cada hoja como mínimo
accuracy(0.80).
random_test_set(0.1).

classes([pos,neg]).
predict(good_credit_risks(+ex,-clss)).


rmode(2: status_existing_checking_account(+Ex,-Att1)).
rmode(2: status_existing_checking_account(+Ex,#)).

rmode(2: duration_in_month(+Ex,-Number)).
% rmode(2: duration_in_month(+Ex,#)).

rmode(2: credit_history(+Ex,-Att3)).
rmode(2: credit_history(+Ex,#)).

rmode(2: purpose(+Ex,-Att4)).
rmode(2: purpose(+Ex,#)).

rmode(2: credit_amount(+Ex,-Number)).
% rmode(2: credit_amount(+Ex,#)).

rmode(2: saving_account(+Ex,-Att6)).
rmode(2: saving_account(+Ex,#)).


rmode(2: present_employment_since(+Ex,-Att7)).
rmode(2: present_employment_since(+Ex,#)).

rmode(2: percentage_of_disposable_income(+Ex,-Number)).
% rmode(2: percentage_of_disposable_income(+Ex,#)).


rmode(2: personal_status_and_sex(+Ex,-Att9)).
rmode(2: personal_status_and_sex(+Ex,#)).


rmode(2: other_debtors_guarantors(+Ex,-Att10)).
rmode(2: other_debtors_guarantors(+Ex,#)).

rmode(2: present_resident_since(+Ex,-Number)).
rmode(2: present_resident_since(+Ex,#)).

rmode(2: property(+Ex,-Att12)).
rmode(2: property(+Ex,#)).


rmode(2: age_in_years(+Ex,-Number)).
% rmode(2: age_in_years(+Ex,#)).


rmode(2: other_installment_plans(+Ex,-Att14)).
rmode(2: other_installment_plans(+Ex,#)).


rmode(2: housing(+Ex,-Att15)).
rmode(2: housing(+Ex,#)).


rmode(2: number_credits_in_this_bank(+Ex,-Number)).
rmode(2: number_credits_in_this_bank(+Ex,#)).


rmode(2: job(+Ex,-Att17)).
rmode(2: job(+Ex,#)).


rmode(2: number_or_people_to_maintenance(+Ex,-Number)).
rmode(2: number_or_people_to_maintenance(+Ex,#)).



rmode(2: telephone(+Ex,-Att19)).
rmode(2: telephone(+Ex,#)).


rmode(2: foreign_worker(+Ex,-Att20)).
rmode(2: foreign_worker(+Ex,#)).



typed_language(yes).
type(status_existing_checking_account(ex,att1)).
type(duration_in_month(ax,number)).
type(credit_history(ex,att3)).
type(purpose(ex,att4)).
type(credit_amount(ex,number)).
type(saving_account(ex,att6)).
type(present_employment_since(ex,att7)).
type(percentage_of_disposable_income(ex,number)).
type(personal_status_and_sex(ex,att9)).
type(other_debtors_guarantors(ex,att10)).
type(present_resident_since(ex,number)).
type(property(ex,att12)).
type(age_in_years(ex,number)).
type(other_installment_plans(ex,att14)).
type(housing(ex,att15)).
type(number_credits_in_this_bank(ex,number)).
type(job(ex,att17)).
type(number_or_people_to_maintenance(ex,number)).
type(telephone(ex,att19)).
type(foreign_worker(ex,att20)).


type(number =< number).
type(number >= number).
% type(number = number).


auto_lookahead(duration_in_month(Ex,Number),[Number]).
auto_lookahead(credit_amount(Ex,Number),[Number]).
auto_lookahead(percentage_of_disposable_income(Ex,Number),[Number]).
auto_lookahead(age_in_years(Ex,Number),[Number]).




discretize(entropy).

discretization(bounds(5)).

to_be_discretized(duration_in_month(Ex,Number),[Number]).
rmode(1: #(C:threshold(duration_in_month(_, Number), [Number], C), +Number >= C)).
rmode(1: #(C:threshold(duration_in_month(_, Number), [Number], C),+Number =< C)).
% rmode(1: #(C:threshold(duration_in_month(_, Number), [Number], C),+Number = C)).

to_be_discretized(credit_amount(Ex,Number),[Number]).
rmode(1: #(C:threshold(credit_amount(_, Number), [Number], C), +Number >= C)).
rmode(1: #(C:threshold(credit_amount(_, Number), [Number], C),+Number =< C)).
% rmode(1: #(C:threshold(credit_amount(_, Number), [Number], C),+Number = C)).

to_be_discretized(percentage_of_disposable_income(Ex,Number),[Number]).
rmode(1: #(C:threshold(percentage_of_disposable_income(_, Number), [Number], C), +Number >= C)).
rmode(1: #(C:threshold(percentage_of_disposable_income(_, Number), [Number], C),+Number =< C)).
% rmode(1: #(C:threshold(percentage_of_disposable_income(_, Number), [Number], C),+Number = C)).


to_be_discretized(age_in_years(Ex,Number),[Number]).
rmode(1: #(C:threshold(age_in_years(_, Number), [Number], C), +Number >= C)).
rmode(1: #(C:threshold(age_in_years(_, Number), [Number], C),+Number =< C)).
% rmode(1: #(C:threshold(age_in_years(_, Number), [Number], C),+Number = C)).


